
package com.eascs.admin.o2o.loanAccount.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.eascs.admin.common.controller.BaseMasterViewController;
import com.eascs.admin.o2o.loanAccount.entity.AccountLog;
import com.eascs.admin.o2o.loanAccount.entity.AccountLogForm;
import com.eascs.admin.o2o.loanAccount.serviceimpl.AccountLogImpl;
import com.eascs.app.dao.PageResult;
import com.eascs.common.util.UrlUtil;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.page.SelectDataOption;
import com.eascs.site.view.ViewContext;
import com.eascs.site.view.button.Button;
import com.eascs.site.view.button.ButtonHelper;
import com.eascs.tag.MenuTag;

/**@Description:
 *               <p>
 *               日志（帐务系统接口）查询功能
 *               </p>
 * @author LMX
 * @date 2017年12月19日 上午10:44:12
 */
@Controller
@RequestMapping("/accountlog")
public class AccountLogController extends BaseMasterViewController{

	@Autowired
	AccountLogImpl accountLogImpl;
	
	@RequestMapping("/list")
	public String list(AccountLogForm vo) {
		ViewContext.put(MenuTag.CURRENT_MENU_CODE, "AccountLogQuery");
		vo.setPageSize(10);
		String o2ourl = "/accountlog/list";
		String id = vo.getId() == null ? "" : vo.getId();
		String logType=vo.getLogType()==null?"":vo.getLogType();
        String requestid=vo.getRequestid()==null?"":vo.getRequestid();//业务单号
		String loanapplyNo=vo.getLoanapplyNo()==null?"":vo.getLoanapplyNo();//经营平台
		String classname = vo.getClassname() == null ? "" : vo.getClassname();
		String methodname = vo.getMethodname() == null ? "" : vo.getMethodname();
		String status = vo.getStatus() == null ? "" : vo.getStatus();
		String requestPs = vo.getRequestPs() == null ? "" : vo.getRequestPs();
		String responsePs = vo.getResponsePs() == null ? "" : vo.getResponsePs();
		String uniqueId = vo.getUniqueId() == null ? "" : vo.getUniqueId();
		String startTime = vo.getStartTime()== null ? "" : vo.getStartTime();
		String endTime = vo.getEndTime() == null ? "" : vo.getEndTime();
		o2ourl = UrlUtil.appendUrl(o2ourl, "id", id);
		o2ourl = UrlUtil.appendUrl(o2ourl, "logType", logType);
		o2ourl = UrlUtil.appendUrl(o2ourl, "requestid", requestid);
		o2ourl = UrlUtil.appendUrl(o2ourl, "loanapplyNo", loanapplyNo);
		o2ourl = UrlUtil.appendUrl(o2ourl, "classname", classname);
		o2ourl = UrlUtil.appendUrl(o2ourl, "methodname", methodname);
		o2ourl = UrlUtil.appendUrl(o2ourl, "status", status);
		o2ourl = UrlUtil.appendUrl(o2ourl, "requestPs", requestPs);
		o2ourl = UrlUtil.appendUrl(o2ourl, "responsePs", responsePs);
		o2ourl = UrlUtil.appendUrl(o2ourl, "uniqueId", uniqueId);
		o2ourl = UrlUtil.appendUrl(o2ourl, "startTime", startTime);
		o2ourl = UrlUtil.appendUrl(o2ourl, "endTime", endTime);
		o2ourl = o2ourl + "&pageIndex=";
		PageResult<Object[]> pageResult = accountLogImpl.findAccountLogByPage(vo) ;
		String titles[] = { "贷款单号", "业务类型", "请求ID", "发起包名或类名", "方法名", "状态","开始时间", "结束时间", "请求信息", "反馈信息" };// ,
		SelectDataOption[] selectDataOptions = {null, new SelectDataOption("AccountLogType"), null, null, null, new SelectDataOption("Querystatus"), null, null, null, null, null};
//		Button[] titleButtons = new Button[] { ButtonHelper.createAjaxButton(null, "/raccountlog/detail?id=") };//弹框
		Button[] titleButtons = new Button[] { ButtonHelper.createOpenButton(null, "/accountlog/detail?id=") };//另起页
		PaginationInfo o2oPagingInfo = new PaginationInfo(pageResult, titles, o2ourl);
		o2oPagingInfo.setSelectDataOptions(selectDataOptions);
		o2oPagingInfo.setFirstRenderColumnIndex(1);
		o2oPagingInfo.setTitleButtons(titleButtons);
		ViewContext.put("paginationInfo", o2oPagingInfo);
		ViewContext.put("vo", vo);
		return "/accountLog/list";
	}
	
	/**
	 * @Description:
	 *               <p>
	 *               帐务系统接口日志 详情
	 *               </p>
	 * @author LMX
	 * @date 2018年1月30日 下午2:00:04
	 * @version V1.0
	 */
	@RequestMapping("/detail")
	public String detail(String id){
		AccountLog vo = accountLogImpl.fingLogByLoanapplyNo(id);
		ViewContext.put("vo", vo);
		return "/accountLog/accountLog_detail2";
	}
	
}
